<h2><?php echo $title ?></h2>
<?php  foreach ($news as $news_item): ?>

    <h3><?php echo  $news_item['title']; ?></h3>
    <div class="main">
        <?php  echo $news_item['text'];  ?>
    </div>
<p><a href="<?php echo site_url('news/'.$news_item['slug']); ?>">View article</a></p>


<?php endforeach; ?>
<p id="p3"></p>
<image src="<?php echo  site_url(); ?>images/20170816092247_7970.png" height="100" width="100" />
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script>
    $.ajax({
        type: "GET",
        url: "<?php echo site_url('app_news') ?>",
        data:{'name':1},
        dataType: "json",
        success: function(data){
            alert(data.name);
           $("#p3").text(data.name);
        }
    });
</script>


</script>
